import tensorflow as tf

def event_demo():
    a = tf.constant(20,name='a')
    b = tf.constant(30,name='b')
    c = a+b
    print('c:', c)
    #开启会话
    with tf.Session() as sess:
        c_value = sess.run(c)
        print('c_value:', c_value)
        #生成event文件
        writer = tf.summary.FileWriter('/Users/taotao/Desktop/test', graph=tf.get_default_graph())
        writer.close()


if __name__ == '__main__':
    event_demo()


#在终端输入tensorboard --logdir="/Users/taotao/Desktop/test"，
# 然后打开网页输入http://localhost:6006/#graphs就可以看到生层的图